<?php

if (!defined("IN_OP"))
{
    exit("You can't access this file directly...");
}
if (( $curruser['acl'] < 255 || $curruser['acl'] == 255 && $curruser['prev_id'] != 0 ) && !SubAccountRight($curruser, 1))
{
    diemsg("你不是管理者！");
}
$ui = new UI();
$tpl = new Template2();
global $curruser;
$user = new User();
$rs = getdb("select id,round,open,spec from lotto where open>='" . date("Y-m-d") . "' order by open");
if ($rs->eof)
{
    $ui->showErrorPage("<p>目前没有期数！</p>");
    exit();
}
$lotto_id = $rs->f['id'];
$round = $rs->f['round'];
$open = $rs->f['open'];
$opnumber = $rs->f['spec'];
$rs->close();
$tpl->set("lotto_id", $lotto_id);
$tpl->set("round", d3($round));
$tpl->set("open", $open);
$conf = new config();
$stopbet = $conf->get("stopbet");
$startmode = "";
if (date("Y-m-d") < $open)
{
    $startmode = "disabled";
}
else if (date("Y-m-d") == $open)
{
    if ($stopbet <= date("Hi") && 0 < $opnumber)
    {
        $startmode = "disabled";
    }
    else if (date("Hi") <= $conf->get("startbet"))
    {
        $startmode = "disabled";
    }
}
$t1 = strtotime($open . " " . $stopbet);
$tpl->Set("timestap", $t1 - systime());
$tpl->set("phptime", systime());
$b01 = isset($_COOKIE['b01']) ? $_COOKIE['b01'] : "";
$tpl->set("b01", $b01);
$b02 = isset($_COOKIE['b02']) ? $_COOKIE['b02'] : "";
$tpl->set("b02", $b02);
$b03 = "";
$tpl->set("b03", $b03);
$b11 = isset($_COOKIE['b11']) ? $_COOKIE['b11'] : "";
$tpl->set("b11", $b11);
$b12 = isset($_COOKIE['b12']) ? $_COOKIE['b12'] : "";
$tpl->set("b12", $b12);
$b13 = "";
$tpl->set("b13", $b13);
$tpl->set("startnowdisable", $startmode);
$prot_user = array();
$j = 0;
$i = 0;
while ($i < 10)
{
    $name = $conf->get("port_systemuser_" . $i);
    if ($name != "")
    {
        $prot_user[$j] = $name;
        ++$j;
    }
    ++$i;
}
$userrame1 = "&nbsp;<select name=usr1 style='display:none'><option value='' selected> </option>";
$i = 0;
while ($i < $j)
{
    $userrame1 .= "<option value='" . $i . "'>" . $prot_user[$i] . "</option>";
    ++$i;
}
$userrame1 .= "</select>";
$tpl->set("select_usr1", $userrame1);
$userrame2 = "&nbsp;<select name=usr2 style='display:none'><option value='' selected> </option>";
$i = 0;
while ($i < $j)
{
    $userrame2 .= "<option value='" . $i . "'>" . $prot_user[$i] . "</option>";
    ++$i;
}
$userrame2 .= "</select>";
$tpl->set("select_usr2", $userrame2);
include_once( "class_6h/class.menu.php" );
$fieldArr = array("round" => $round, "open" => $open, "lotto_id" => $lotto_id, "split_id" => 1);
$onlineMenu = new menu_6h(2, $fieldArr);
$selectid = getvar("select") == "" ? 0 : getvar("select");
$menuList = $onlineMenu->getMenu($selectid);
$tpl->set("menuList", $menuList);
unset($onlineMenu);
$tpl->load("main", "unow1.htm");
$tpl->set("jslang", $g_conf['language']);
$tpl->show("main");
$ui->footer();
?>